package com.lwl.office.dcconverter.element;

import com.lwl.office.webeditor.ParserContext;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPr;

public class DCUnorderedList extends DCParagraph {


    public DCList addList(){
        DCList dcList = new DCList();
        addChild(dcList);
        return dcList;
    }

    @Override
    public void parseWord(ParserContext context) {
        XWPFParagraph paragraph = context.createParagraph();
        CTP ctp = paragraph.getCTP();
        CTPPr ctpPr =ctp.isSetPPr()?ctp.getPPr():ctp.addNewPPr();
        ctpPr.addNewNumPr().addNewNumId().setVal(context.getNumbering(getTagName()));
        //子节点解析成word
        for (AbsDCElement child : getChildren()) {
            child.parseWord(context);
        }
    }

    @Override
    public String getTagName() {
        return "ul";
    }
}
